<template>
	<view class="content">
		<image class="img" src="/static/image/user/login.png" mode="widthFix"></image>
		<view class="form">
			<view class="in">
				<input type="text" v-model.trim="data.username" placeholder="请输入用户名"/>
			</view>
			<view class="in">
				<input type="password" v-model.trim="data.password" placeholder="请输入密码"/>				
			</view>
			<view class="loginBtn" @click="login()">
				<text class="btnValue">{{info}}</text>
			</view>
			<view class="Btn">
				<text id="text1" @click="register()">注册账号</text>
				<text id="text2">找回密码</text>
			</view>
		</view>
	</view>
</template>
<script>
	import api from 'pages/api.js'
	export default {
		data() {
			return {
				info:'登录',
				data:{
					is1:true,
					is2:true,
					username:'',
					password:''
				}
			}
		},
		computed:{
			isLogin(){
				return this.$store.state.isLogin
			}
		},
		methods: {
			login(){
				uni.showLoading({
				    title: '加载中'
				});
				api.login(this.data,this.$store)
			},
			register(){
				uni.redirectTo({
					url: '/pages/user/register',
				})
			}
		}
	}
</script>
<style scoped>
	span{
		color:red;
	}
	.content {
		position: relative;
		top: var(--status-bar-height);
		background: #ffffff;
		width: 100vw;
		height: 100vh;
		text-align: center;
	}
	.img{
		position: relative;
		top:260rpx;
		width: 200rpx;
		height: auto;
	}
	.form{
		padding: 0 120rpx;
		margin-top: 45%;
	}
	.in{
		width: 100%;
		height: 80rpx;
		background: white;
		border-radius: 42rpx;
		box-sizing: border-box;
		padding: 0 42rpx;
		margin-top: 18rpx;
		box-shadow:0px 0px 6rpx #878787;
	}
	input{
		width: 100%;
		height: 100%;
		text-align: center;
		font-size: 32rpx;
	}
	.loginBtn{
		width: 100%;
		height: 80rpx;
		background: #2db7f5;
		border-radius: 50rpx;
		margin-top: 64rpx;
		margin-bottom: 12rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.loginBtn .btnValue{
		color: white;
		font-size: 32rpx;
	}
	.Btn{
		text-align: center;
		color: #00aaff;
		font-size: 32rpx;
	}
	#text1{
		padding:0 100rpx 0 0;
	}
	#text2{
		padding:0 0 0 100rpx;
	}
</style>